<div class="page-container">
	<h1 class="header"><i>Новости</i></h1>
	<div class="content">
	    <?php if (count($this->paginator) <=0): ?>
	        Извините, но для Вас новостей не найдено.
	    <?php else: foreach ($this->paginator as $news): ?>
	    <div class="news-wrap">
	        <div class="news-header">
	            <?php echo $news->title ?>
	        </div>
	        <div class="news-body"><?php
	            preg_match_all('/\$(audio|video)\=([a-zA-Zа-яА-я0-9_\-\=\+\/\|\?\:\;\.\,\%\&]*)\$/', stripslashes($news->content), $m);
		        $count = count($m[0]);
		        $content = stripslashes($news->content);
		        for ($i=0; $i<$count; $i++) {
			        if ($m[1][$i] == 'audio') {
				        $content = strtr(
					        $content,
					        array($m[0][$i] => '<audio src="' . $m[2][$i] . '" type="audio/mp3" controls="controls"></audio>')
				        );
			        } elseif ($m[1][$i] == 'video') {
				        $content = strtr(
					        $content,
					        array($m[0][$i] => '<video src="' . $m[2][$i] . '" type="video/mp4" controls="controls"></audio>')
				        );
			        }
		        }
		        $c = strpos($content, '$stop$');
				if ($c !== false) {
					$content = substr($content, 0, $c) . '<a style="font-size: 11px;" href="/news/' . $news->url_key .'">Дальше »</a>';
					echo $content;
				} else {
					echo $content;
				}
	        ?>
	        </div>
	        <div class="news-info">
	            <b>Создано: </b><?php
	                $date = new Zend_Date($news->created, false, Pidguin_Application::getInstance()->getLocale());
					echo $date->toString('dd MMMM YYYYг. в HH:mm');
	            ?>,
	            <b>Автор: </b><?php echo $news->findParentRow('Model_User')->name ?>,
	            <b>Комментарий: </b><?php echo count($news->findDependentRowset('Model_NewsComments')) ?>
	            <div class="right" style="display: inline-block; float: right;">
	                <a href="/news/<?php echo $news->url_key ?>">Открыть новость</a>
	            </div>
	        </div>
	    </div>
	    <?php endforeach; ?>
			<?php echo $this->paginationControl($this->paginator,'Sliding','pagination/control.php'); ?>
		<?php endif; ?>
	</div>
</div>
